"""
wx 配置读取
"""
import os
import configparser


class ConfigParser:

    def __init__(self):
        self.config_path = os.path.join(os.path.dirname(__file__), "wx.ini")
        self.conf = configparser.ConfigParser()
        self.conf.read(self.config_path, encoding="utf-8")

    def get_appid(self):
        """
        获取app_id
        """
        return self.conf.get("wxmini", "appid")

    def get_notify_url(self):
        """
        支付回调地址
        """
        return self.conf.get("wxmini", "notify_url")

    def get_appsecret(self):
        """
        获取 app_secret
        """
        return self.conf.get("wxmini", "secret")

    def get_mch_id(self):
        """
        获取商户id
        """
        return self.conf.get("wxmini", "mchid")

    def get_login_url(self):
        """
        获取登录接口地址
        """
        return self.conf.get("wxmini", "login_url")

    def get_serial_no(self):
        """
        获取证书序列号
        """
        return self.conf.get("wxmini", "serial_no")

    def get_pay_url(self):
        """
        获取支付地址
        """
        return self.conf.get("wxmini", "pay_url")
